import { ResponseModel, ResponseStructure } from '@/model/responseModel';
import { RequestServiceProxy } from '@/utils/request';
import {
  BiometricModel,
  DicModel,
  EmployeeModel,
  OrganizationModel,
  PositionModel,
  StrangerModel,
} from './data';

const _request = new RequestServiceProxy();

// 获取员工分页列表
export async function getemployeeList(
  param?: EmployeeModel.employeeRequest,
): Promise<ResponseStructure<ResponseModel<EmployeeModel.employeeResponse>>> {
  return await _request.post('/person/employee/page', param);
}

//员工查询
export async function queryemployee(
  param: EmployeeModel.employeeRequest,
): Promise<ResponseStructure<EmployeeModel.employeeResponse>> {
  return await _request.post<ResponseStructure<EmployeeModel.employeeResponse>>(
    '/person/employee/query',
    param,
  );
}

//新增员工
export async function createemployee(
  param: EmployeeModel.employeeResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/employee/create', param);
}

//修改员工
export async function updateemployee(
  param: EmployeeModel.employeeResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/employee/update', param);
}

//删除员工
export async function deleteemployee(
  param: EmployeeModel.deleteEmployeeModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/employee/delete', param);
}

// 获取部门分页列表
export async function getDeptList(
  param?: OrganizationModel.organizationRequest,
): Promise<ResponseStructure<ResponseModel<OrganizationModel.organizationResponse>>> {
  return await _request.post('/api/person/organization/page', param);
}

//部门查询
export async function queryDept(
  param: OrganizationModel.organizationRequest,
): Promise<ResponseStructure<ResponseModel<OrganizationModel.organizationResponse>>> {
  return await _request.post<
    ResponseStructure<ResponseModel<OrganizationModel.organizationResponse>>
  >('/person/organization/query', param);
}

//部门列表
export async function deptList(
  param?: OrganizationModel.organizationRequest,
): Promise<ResponseStructure<OrganizationModel.organizationResponse[]>> {
  return await _request.post<ResponseStructure<OrganizationModel.organizationResponse[]>>(
    '/person/organization/list',
    param,
  );
}

//新增部门
export async function createDept(
  param: OrganizationModel.organizationResponse,
): Promise<ResponseStructure<void>> {
  console.log(param);
  return await _request.post<ResponseStructure<void>>('/api/person/organization/create', param);
}

//修改部门
export async function updateDept(
  param: OrganizationModel.organizationResponse,
): Promise<ResponseStructure<void>> {
  console.log(param);
  return await _request.post<ResponseStructure<void>>('/api/person/organization/update', param);
}

//删除部门
export async function deleteDept(
  param: OrganizationModel.deleteOrganizationModel,
): Promise<ResponseStructure<void>> {
  return await _request.delete<ResponseStructure<void>>('/api/person/organization/delete', param);
}

// 获取职位分页列表
export async function getPositionList(
  param?: PositionModel.positionRequest,
): Promise<ResponseStructure<ResponseModel<PositionModel.positionResponse>>> {
  return await _request.post('/person/position/page', param);
}

//职位查询
export async function queryPosition(
  param: PositionModel.positionRequest,
): Promise<ResponseStructure<PositionModel.positionResponse>> {
  return await _request.post<ResponseStructure<PositionModel.positionResponse>>(
    '/person/position/query',
    param,
  );
}

//新增职位
export async function createPosition(
  param: PositionModel.positionResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/position/create', param);
}

//修改职位
export async function updatePosition(
  param: PositionModel.positionResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/position/update', param);
}

//删除职位
export async function deletePosition(
  param: PositionModel.deletePositionModel,
): Promise<ResponseStructure<void>> {
  return await _request.delete<ResponseStructure<void>>('/api/person/position/delete', param);
}

// 获取离职分页列表
export async function getStrangerList(
  param?: StrangerModel.strangerRequest,
): Promise<ResponseStructure<ResponseModel<StrangerModel.strangerResponse>>> {
  return await _request.post('/person/stranger/page', param);
}

//离职查询
export async function queryStranger(
  param: StrangerModel.strangerRequest,
): Promise<ResponseStructure<StrangerModel.strangerResponse>> {
  return await _request.post<ResponseStructure<StrangerModel.strangerResponse>>(
    '/person/stranger/query',
    param,
  );
}

//新增离职
export async function createStranger(
  param: StrangerModel.strangerResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/stranger/create', param);
}

//修改离职
export async function updateStranger(
  param: StrangerModel.strangerResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/stranger/update', param);
}

//删除离职
export async function deleteStranger(
  param: StrangerModel.deleteStrangerModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/stranger/delete', param);
}

// 获取生物识别分页列表
export async function getBiometricList(
  param?: BiometricModel.biometricRequest,
): Promise<ResponseStructure<ResponseModel<BiometricModel.biometricResponse>>> {
  return await _request.post('/person/biometric/page', param);
}

//生物识别查询
export async function queryBiometric(
  param: BiometricModel.biometricRequest,
): Promise<ResponseStructure<BiometricModel.biometricResponse>> {
  return await _request.post<ResponseStructure<BiometricModel.biometricResponse>>(
    '/person/biometric/query',
    param,
  );
}

//新增生物识别
export async function createBiometric(
  param: BiometricModel.biometricResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/biometric/create', param);
}

//修改生物识别
export async function updateBiometric(
  param: BiometricModel.biometricResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/biometric/update', param);
}

//删除生物识别
export async function deleteBiometric(
  param: BiometricModel.deleteBiometricModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/biometric/delete', param);
}

// 获取字典分页列表
export async function getDicList(
  param?: DicModel.dicRequest,
): Promise<ResponseStructure<ResponseModel<DicModel.dicResponse>>> {
  return await _request.post('/person/dic/page', param);
}

//字典查询
export async function queryDic(
  param: DicModel.dicRequest,
): Promise<ResponseStructure<DicModel.dicResponse>> {
  return await _request.post<ResponseStructure<DicModel.dicResponse>>(
    '/person/dic/query',
    param,
  );
}

//新增字典
export async function createDic(
  param: DicModel.dicResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/dic/create', param);
}

//修改字典
export async function updateDic(
  param: DicModel.dicResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/dic/update', param);
}

//删除字典
export async function deleteDic(
  param: DicModel.deleteDicModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/person/dic/delete', param);
}
